
<% content_for :content do %>
<h3>Edycja danych użytkownika <%=@user.login %></h3>	
<%= javascript_include_tag 'livevalidation' %>
<%= javascript_include_tag 'validationFunctions' %>
<%= stylesheet_link_tag 'live_validation' %>
<%= error_messages_for :user %>

<% form_for(@user, :url => { :action => "update" }) do |user_form| %>
<% if session[:user_id]!=@user.id%>
	<p>
	<label for="user_login">Login:</label>
	<%= user_form.text_field :login, :size => 40 %>
	</p>
	<SCRIPT>addPresenceValidation('user_login')</SCRIPT>
<% end %>

	<%= hidden_field_tag :id,  @user.id %>
	<p>
	<label for="user_password">Nowe Hasło:</label>
	<%= user_form.password_field :PASSWORD, :size => 40 %>
	</p>
	<p>
	<label for="user_password_confirmation">Powtórz nowe hasło:</label>
	<%= user_form.password_field :password_confirmation, :size => 40 %>
	</p>
<SCRIPT>
	var f19 = new LiveValidation('user_password_confirmation',{validMessage: " "});
	f19.add( Validate.Confirmation, { match: 'user_PASSWORD',failureMessage:" "} );
</SCRIPT>	
	<p>
	<label for="user_email">Email:</label>
	<%= user_form.text_field :email, :size => 40 %>
	</p>
	<p>
	<label for="user_email">Numer PESEL:</label>
	<%= user_form.text_field :pesel, :size => 40 %>
	</p>		
	<p>
	<label for="user_position_id">Stanowisko:</label>	
	<%=
			@positions = Position.find(:all, :order => "NAME").map {|u| [u.name, u.id] }
			user_form.select( :positionID,@positions)
	%>
	</p>

		<p>
		<label for="user_role_id">Rola w systemie:</label>	
		<%=
				@systemRoles = SystemRole.find(:all, :order => "NAME").map {|u| [u.name, u.id] }
				user_form.select( :roleID,@systemRoles,:size=>40 )
				
		%>
		</p>
		
		<p>
		<label for="user_expiry_date">Termin wygaśnięcia konta:</label>	
			<%= user_form.datetime_select(:expiry_date,:default => 2.week.from_now) %>
		</p>
	
		<p>
	        <br/>
		<%= user_form.submit "Zapisz zmiany", :class => "submit" %>
		</p>
		
<% end %>
<p>
<!-->	<%= link_to 'Powrót',:back %> <-->
</p>

<% end %>